const Success = require('./success.js');
class Fails extends Success {
  constructor() {
    super();
  }
  setPop() {
    this.setMask();
    let popBox = game.add.group();
    let pop = popBox.create(0, 0, 'player_restart');
    popBox.x = this.cx;
    popBox.y = this.cy;
    pop.anchor.setTo(0.5, 0.5);
    // 设置按钮点击热区
    let button = game.add.graphics(0, 0);
    button.beginFill("0x720e0e", 0);
    button.drawRoundedRect(-popBox.width * 0.25, popBox.height * 0.18, pop.width * 0.5, pop.height * 0.2, 10);
    button.anchor.setTo(0.5, 0.5);
    button.inputEnabled = true;
    button.events.onInputDown.add(v => {
      game.state.start('Playing')
    })
    popBox.add(button);
  }
  create() {
    this.setBg();
    this.setPop();
  }
}

module.exports = Fails;